package com.huahua.api.controller.crypto;

import com.huahua.api.entity.base.R;
import com.huahua.api.entity.param.UrlCodecParam;
import com.huahua.api.service.UrlCodecService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

/**
 * URL编码解码控制器
 */
@RestController
@RequestMapping("/crypto/url")
@RequiredArgsConstructor
public class UrlCodecController {

    private final UrlCodecService urlCodecService;

    /**
     * URL编码解码操作
     *
     * @param param 编码解码参数
     * @return 处理结果
     */
    @PostMapping("/process")
    public Mono<R<String>> process(@RequestBody UrlCodecParam param) {
        return urlCodecService.process(param)
                .map(R::success);
    }
}
